package com.bj58.mis.apm.server.kylin.common.util;

import org.apache.commons.lang.text.StrSubstitutor;

import java.util.Properties;

public class KylinConfig {
    volatile Properties properties;

    public KylinConfig(){
        this.properties = new Properties();
    }

    protected String getOptional(String prop, String dft) {
        String property = System.getProperty(prop);
        return property != null ? StrSubstitutor.replace(property, System.getenv()) : StrSubstitutor.replace(this.properties.getProperty(prop, dft), System.getenv());
    }
    public long getCubeAggrGroupMaxCombination() {
        return Long.parseLong(this.getOptional("kylin.cube.aggrgroup.max-combination", "4096"));
    }
    public boolean getCubeAggrGroupIsMandatoryOnlyValid() {
        return Boolean.parseBoolean(this.getOptional("kylin.cube.aggrgroup.is-mandatory-only-valid", "false"));
    }
}
